/**
 * edurender
 * gler_context.h
 * (c) 2009 J. Brad Byrd
 */

#ifndef GLER_CONTEXT_H
#define GLER_CONTEXT_H

#include "../../include/edurender/er.h"

#include "../er/er_math.h"

#include <windows.h>
#include <GL/gl.h>

#define GLER_IMM_VERT_COUNT 50000
#define GLER_MODELVIEW_MAX 32
#define GLER_PROJECTION_MAX 4

typedef struct GLERContext
{
	ERContext er;
	HDC hdc;
	ERbool imm;
	ERVector3f immVerts[GLER_IMM_VERT_COUNT];
	ERuint immIndex;
	GLenum immPrim;
	GLenum matrixMode;
	ERuint mvIndex;
	ERuint projIndex;
	ERMatrix4x4f mvStack[GLER_MODELVIEW_MAX];
	ERMatrix4x4f projStack[GLER_PROJECTION_MAX];
} GLERContext;

int glerGetPixelFormatCount();
const PIXELFORMATDESCRIPTOR *glerDescribePixelFormat(int index);
void glerSetActiveContext(GLERContext *context);
void glerSetPixelFormat(int index);
GLERContext *glerCreateContext(HDC hdc);
void glerDestroyContext(GLERContext *context);
//BOOL glerMakeCurrent(HDC hdc, GLERContext *context);
//BOOL glerSwapBuffers(HDC hdc);

//GLERContext *glerGetCurrentContext();

#endif // GLER_CONTEXT_H
